package com.ruan.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruan.query.ShoppingCartQuery;
import com.ruan.service.ShoppingCartService;
import com.ruan.vo.ShoppingCartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName:ShoppingCartController
 * @Author:阮昇
 * @Description:
 * @Datetime: 2023/6/20 16:55
 **/
@RestController
@RequestMapping("/shoppingCart")
public class ShoppingCartController {

    @Autowired
    private ShoppingCartService shoppingCartService;

    @RequestMapping("/getShoppingCartList")
    public PageInfo<ShoppingCartVo> getShoppingCartList(ShoppingCartQuery shoppingCartQuery){
        //开启分页
        PageHelper.startPage(shoppingCartQuery.getPageNum(),shoppingCartQuery.getPageSize());

        List<ShoppingCartVo> userVoList = shoppingCartService.getShoppingCartList(shoppingCartQuery);

        PageInfo<ShoppingCartVo> pageInfo = new PageInfo<>(userVoList);

        return pageInfo;

    }

}
